package com.example.lenovo.demo;

import android.app.ProgressDialog;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.lenovo.demo.model.databean.StrategyBean;
import com.example.lenovo.demo.presenter.StrategyChildActivityPresenter;
import com.example.lenovo.demo.view.ifgview.IStrategyActivity;
import com.example.lenovo.demo.view.ifgview.IStrategyChildActivity;

import org.xutils.view.annotation.ContentView;
import org.xutils.view.annotation.ViewInject;
import org.xutils.x;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@ContentView(R.layout.activity_strategy_child)
public class StrategyChildActivity extends AppCompatActivity {
    private ArrayList<StrategyBean> data;
    private int numParent,numChild,totalNum;
    private StrategyChildActivityPresenter presenter;
    private IStrategyChildActivity view;
    private ProgressDialog progressDialog;


    @ViewInject(R.id.strategy_child_vp)
    private ViewPager viewPager;
    @ViewInject(R.id.strategy_child_imgback)
    private ImageView imageView;
    @ViewInject(R.id.strategy_child_toolbar_textview)
    private TextView textView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        x.view().inject(this);
        initView();
        initData();

    }

    private void initData() {
        Bundle bundle=getIntent().getExtras();
        data=bundle.getParcelableArrayList("msg");
        totalNum=bundle.getInt("totalnum");
        numParent=bundle.getInt("numparent");
        numChild=bundle.getInt("numchild");
        presenter=new StrategyChildActivityPresenter();
        view=presenter;
        view.getView(viewPager,this,imageView,textView,data,getSupportFragmentManager(),progressDialog,numParent,numChild,totalNum);
        presenter.initData();
    }

    private void initView() {
        progressDialog=new ProgressDialog(this);
        progressDialog.setTitle("提示");
        progressDialog.setMessage("正在加载...");
        progressDialog.setCancelable(true);
    }

}
